<?php

/**
 * MlMachinesVersion form base class.
 *
 * @method MlMachinesVersion getObject() Returns the current form's model object
 *
 * @package    maslogger
 * @subpackage form
 * @author     Michaël VEROUX
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseMlMachinesVersionForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                     => new sfWidgetFormInputHidden(),
      'numero'                 => new sfWidgetFormInputText(),
      'socle'                  => new sfWidgetFormInputText(),
      'emplacement'            => new sfWidgetFormInputText(),
      'date_mise_service'      => new sfWidgetFormDate(),
      'numero_serie'           => new sfWidgetFormInputText(),
      'numero_lecteur_carte'   => new sfWidgetFormInputText(),
      'marque_id'              => new sfWidgetFormInputText(),
      'jeux'                   => new sfWidgetFormInputText(),
      'date_cessation'         => new sfWidgetFormDate(),
      'destination_cessation'  => new sfWidgetFormInputText(),
      'token'                  => new sfWidgetFormChoice(array('choices' => array('coinless' => 'coinless', '0,01' => '0,01', '0,02' => '0,02', '0,05' => '0,05', '0,10' => '0,10', '0,20' => '0,20', '0,50' => '0,50', 1 => '1', 2 => '2', 5 => '5', 10 => '10', 20 => '20'))),
      'bill_acceptor'          => new sfWidgetFormInputCheckbox(),
      'tito'                   => new sfWidgetFormInputCheckbox(),
      'cashless'               => new sfWidgetFormInputCheckbox(),
      'taux_de_redistribution' => new sfWidgetFormInputText(),
      'denomination'           => new sfWidgetFormInputText(),
      'created_at'             => new sfWidgetFormDateTime(),
      'updated_at'             => new sfWidgetFormDateTime(),
      'deleted_at'             => new sfWidgetFormDateTime(),
      'version'                => new sfWidgetFormInputHidden(),
    ));

    $this->setValidators(array(
      'id'                     => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'numero'                 => new sfValidatorInteger(),
      'socle'                  => new sfValidatorString(array('max_length' => 15)),
      'emplacement'            => new sfValidatorString(array('max_length' => 15)),
      'date_mise_service'      => new sfValidatorDate(array('required' => false)),
      'numero_serie'           => new sfValidatorString(array('max_length' => 60)),
      'numero_lecteur_carte'   => new sfValidatorString(array('max_length' => 60)),
      'marque_id'              => new sfValidatorInteger(),
      'jeux'                   => new sfValidatorString(array('max_length' => 80)),
      'date_cessation'         => new sfValidatorDate(array('required' => false)),
      'destination_cessation'  => new sfValidatorString(array('max_length' => 80, 'required' => false)),
      'token'                  => new sfValidatorChoice(array('choices' => array(0 => 'coinless', 1 => '0,01', 2 => '0,02', 3 => '0,05', 4 => '0,10', 5 => '0,20', 6 => '0,50', 7 => '1', 8 => '2', 9 => '5', 10 => '10', 11 => '20'), 'required' => false)),
      'bill_acceptor'          => new sfValidatorBoolean(array('required' => false)),
      'tito'                   => new sfValidatorBoolean(array('required' => false)),
      'cashless'               => new sfValidatorBoolean(array('required' => false)),
      'taux_de_redistribution' => new sfValidatorNumber(),
      'denomination'           => new sfValidatorPass(),
      'created_at'             => new sfValidatorDateTime(),
      'updated_at'             => new sfValidatorDateTime(),
      'deleted_at'             => new sfValidatorDateTime(array('required' => false)),
      'version'                => new sfValidatorChoice(array('choices' => array($this->getObject()->get('version')), 'empty_value' => $this->getObject()->get('version'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('ml_machines_version[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'MlMachinesVersion';
  }

}
